﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using NavigationSampleApp.Contexts;
using Smart.Navigation;
using Smart.Navigation.Context;

namespace NavigationSampleApp.Views
{
    /// <summary>
    /// 
    /// </summary>
    [View( ViewId.ContextInput1 )]
    public partial class ContextInput1View : AppViewBase
    {
        [ViewContext]
        protected InputContext context;

        /// <summary>
        /// 
        /// </summary>
        public ContextInput1View()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void OnViewOpen(ViewForwardEventArgs args)
        {
            // ファンクションキー
            FunctionCotrol.UpdateFunctionKeys( null );

            // 表示
            this.txtData1.Text = this.context.Data1;
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnViewClose()
        {
            // 保存
            this.context.Data1 = this.txtData1.Text;
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnButtonExit()
        {
            Navigator.Forward( ViewId.Menu );
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrevButton_Click(object sender, EventArgs e)
        {
            Navigator.Forward( ViewId.Menu );
        }
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NextButton_Click(object sender, EventArgs e)
        {
            Navigator.Forward( ViewId.ContextInput2 );
        }
    }
}